package com.welica.wat;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.welica.wat.config.ZookeeperLockConfig;
import com.welica.wat.impl.ZookeeperLock;

@Configuration
@ConditionalOnProperty(value = "distributed.lock.zookeeper.enable", havingValue = "true")
public class DistributedLockConfiguration {

	@Bean(name = "distributeZookeeperLock")
	public ZookeeperLock distributeLock(ZookeeperLockConfig zookeeperLockConfig) {
		return new ZookeeperLock(zookeeperLockConfig);
	}

}
